﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace xna_game_engine.source
{
    public class State_MainMenu : State_Base
    {
        // Members
        CGameScreen mScreen;

        // Functions
        public State_MainMenu(StateMachine.States Id) : base(Id)
        {
            mName = "Main Menu";
            mScreen = new CGameScreen();
            mScreen.AddElement(new CScreenElementImage("screens//main_menu_background", Vector2.Zero));

            // Map our event handlers
            mEventHandlers[EventManager.Events.EVT_START_HIT] = new EventHandler(OnEnterHit);
        }

        private void OnEnterHit()
        {
            Console.WriteLine("Main Menu: Transitioning to Character Select state...");
            GameGlobals.StateMachine.Transition(StateMachine.States.STATE_CHAR_SELECT);
        }
        // Parental Overrides
        public override void  Init()
        {
            Console.WriteLine("Main Menu Init()...");
            mScreen.Init();
 	        //throw new System.NotImplementedException();
        }

        public override void Enter()
        {
            Console.WriteLine("Main Menu Enter()...");
            //throw new NotImplementedException();
        }

        public override void Update(GameTime gameTime)
        {
            //Console.WriteLine("Main Menu Update()...");
            //throw new NotImplementedException();
            mScreen.Update(gameTime);
        }

        public override void Exit()
        {
            Console.WriteLine("Main Menu Exit()...");
            //throw new NotImplementedException();
        }

        public override void Draw()
        {
            mScreen.Draw();
        }
    }
}
